﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Post through XHR</title>
    <script type="text/javascript">
        function onBtnClick() {
            var text = document.querySelector("input[type='text']").value;

            var xhr = new XMLHttpRequest();
            xhr.open("POST", "/testpost");
            xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
            xhr.send(text);

            console.log("sent");
        }
    </script>
</head>
<body>
    <h1>
        Post through XHR</h1>
    <input type="text" />
    <input type="button" value="Post" onclick="onBtnClick()" />
</body>
</html>
